//
//  main.cpp
//  map-matching
//
//  Created by Lv Xin on 16/4/11.
//  Copyright © 2016年 Lv Xin. All rights reserved.
//
#include "map.h"
#include "trajectory.h"
#include "TR_SIM.h"
#include "RTreeUtils.h"
#include "dijkstra.h"
#include "distance.h"
#include <iostream>

using namespace std;

extern std::vector< std::vector<EdgeDis> > candidateEdge;

int main() {
    setvbuf(stdin, new char[1 << 20], _IOFBF, 1 << 20);
    setvbuf(stdout, new char[1 << 20], _IOFBF, 1 << 20);
    Map* map = new Map();
    map->fileAddNode("BJ.cnode");
    map->fileAddEdge("BJ.edge");
    
    Trajectary test(map);
    test.fileAddPos("testTraj.txt");
    test.generateCandidateEdge();
    
    int canSize = candidateEdge.size();
    
    cerr << canSize << endl;
    
    for(int i = 0; i < canSize; i++){
        cerr << candidateEdge[i].size() << " ";
    }
    cerr << endl;
    
    delete map;
    //Init();//dijkstra的初始化
//    for(int i = 2; i <= 9; i++){
//        if(i == 8) continue;
//        Trajectary traj;
//        GenerateTrajectory route;
//        char r = char('0' + i);
//        string ran = "";
//        ran += r;
//        string tra = "traj" + ran + ".txt";
//        string mat = "match" + ran + ".txt";
//        traj.fileAddPos(tra);
//        route.fileAddPos(mat);
//        TR_SIM sim(route, traj);
//        sim.computeSim();
//        cout << sim.getSim() << endl;
//    }
//    Trajectary traj;
//    GenerateTrajectory route;
//    traj.fileAddPos("traj3.txt");
//    route.fileAddPos("match3.txt");
//    TR_SIM sim(route, traj);
//    sim.computeSim();
//    cout << sim.getSim() << endl;
//    Map* map = new Map();
//    map->fileAddNode("node.txt");
//    map->fileAddEdge("edge.txt");
//    cout << map->nodeSum << " " << map->edgeSum << endl;
//    delete map;
}
